<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>提现</title>
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/all.css"/>
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="js/peizhi.js" type="text/javascript" charset="utf-8"></script>
  </head>
  <body>
    <style type="text/css">
      .container{ padding-top: 15px;}
      .form-group{ border-bottom: 1px #EAEAEA solid;}
      .form-horizontal{ line-height: 35px;}
      .col-xs-4{ text-align: right;}
      .tishi{ text-align: right; font-size: 1rem;}
    </style>
    <div class="alltop">
      <div class="backone2">
        <a href="javascript:;" class="returna"><span class="glyphicon glyphicon-menu-left"></span><b>返回</b></a>
      </div>
      <div class="refresh">
      <a href="#">
        <span class="glyphicon glyphicon-refresh"></span><b>刷新</b></a>
      </div>
    </div>      
    <div class="container">
        
        <form class="form-horizontal">
          <div class="form-group">
            <label  class="col-xs-4 control-label">可提现金额</label>
            <div class="col-xs-8" id="qiaobaoyue">

              <!-- <input type="text" class="form-control" id="jine" placeholder="可提现金额"> -->
            </div>
          </div>
          <div class="form-group">
            <label class="col-xs-4 control-label">提现方式</label>
            <div class="col-xs-8">
                  <input type="radio" name="fangshi" id="inlineRadio1" value="0"> 银行卡
                <input type="radio" name="fangshi" id="inlineRadio2" value="1" checked="checked"> 支付宝
            </div>
          </div>
           <div class="form-group">
            <label for="inputEmail4" class="col-xs-4 control-label">账号/卡号</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" id="yinhangka" placeholder="银行卡号或者支付宝">
            </div>
          </div>
          <div class="form-group">
            <label for="inputEmail4" class="col-xs-4 control-label">开户行</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" id="kaihuhang" placeholder="开户行（银行卡提现必填）">
            </div>
          </div>
         
          <div class="form-group">
            <label for="inputEmail4" class="col-xs-4 control-label">提现金额</label>
            <div class="col-xs-8">
              <input type="text" class="form-control" id="tixianjine" placeholder="提现金额">
            </div>
          </div>
          <div class="tishi">
            申请提现后，将于每月N号发放
          </div>
          <div class="btn tixian" style="width: 100%; background: #ffa328; color: #FFFFFF; font-weight: 600;">
              申请提现
          </div>
      </div>
      <div class="" style="color: #068dff; margin: 15px;">
        提现规则：
      </div>
      <div class="" style="margin: 0 15px; color: #999;">
      遵循官方公告的标准
       <!--  一、费用<br />
        1、免费活动，继续完全免费使用互动吧平台的基础服务；<br />
        2、付费活动，收取其活动交易额的2.5%作为交易服务费，用于
        抵扣平台部分交易成本和服务成本，如向 第三方支付服务商和
        银行机构支付的交易和转账通道手续费。 -->
      </div>
    </div>
    <script src="../lib/soha.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/bootstrap.min.js"></script>
    <script type="text/javascript" src="../lib/vue.min.js"></script>
    <script type="text/javascript" src="../lib/common.js"></script>
    <script type="text/javascript">
    var b = new Base64(); //加密
        query = ''+getUrlQuery().userid;
        if (query == "undefined") {
                query = "zero0";
            }else{
                userid = b.decode(query); //解密urlid
              }
    var myDate = new Date();
    var date = _dateFormat(myDate, 'yyyy-MM-dd');

    postJSON('/api/getahhmoney', { 
                                       "id": parseInt(userid),  
                                       
                                       
        }, function (result) {
            $('#qiaobaoyue').html(result.commission)
            
        }, function (result) {

        });

      $(".tixian").click(function(){

        var zhonge = $('#qiaobaoyue').html();

        
        
        var CashInType = $("input[name='fangshi']:checked").val();
        // var CashInType = $('fangshi:radio:checked').val();
        var BankName = $('#kaihuhang').val();
        var Account = $('#yinhangka').val();
        var Amount = parseInt($('#tixianjine').val());

        if ( Account == "" ) {
          alert("请输入银行卡或支付宝账号！")
          return ;
        }
        if ( Amount == "" ) {
          alert("请输入提现金额！")
          return ;
        }
        if (parseInt(zhonge) < parseInt(Amount) ) {
          alert("提现金额大于可提现金额！")
          return ;
        }

         postJSON('/api/requestwithdrawal', { 
                                       "accountid": parseInt(userid),  
                                       "way": parseInt(CashInType) ,
                                       "bank": BankName,
                                       "accountnumber": Account,
                                       "withdrawalamount": parseInt(Amount),
                                       "date": date,
                                       
        }, function (result) {
             alert("已提交提现申请，请耐心等待！");
              window.location.href='member.html?userid='+query;
            
        }, function (result) {

        });


      
      })
    </script>
  </body>
</html>
